@extends('admin.common.admin_main')
@section('container')
    @include('UEditor::head')
<div class="uc-body">
    <div class="uc-head">
        <ul>
            <li><span class="sel">编辑设备</span></li>
            <li><a href="/user/device_number?device_id={{$device_id}}">管理型号</a></li>
        </ul>
    </div>
    <div class="form form-horizontal">
        <div class="form-body">
            <div class="row">
                <div class="label"><span class="require">*</span>设备名称：</div>
                <div class="control-text">
                    <input id="device_name" class="form-control form-control-lg" type="text" value="{{$dataInfo['device_name']}}">
                </div>
            </div>
            <div class="row">
                <div class="label"><span class="require">*</span>设备类别：</div>
                <div class="control-text">
                    <select id="type_id" class="form-control">
                        <option value="">请选择</option>
                        @forelse ($device_type_list as $key=>$value)
                            <option value="{{$value['id']}}" {{$value['id']==$dataInfo['type_id']?"selected=selected":""}}>{{$value['name']}}</option>
                        @empty
                        @endforelse
                    </select>
                </div>
            </div>
            <div class="row">
                <div class="label"><span class="require">*</span>设备品牌：</div>
                <div class="control-text">
                    <select id="brand_id" class="form-control">
                        <option value="">请选择</option>
                        @forelse ($brand_type_list as $key=>$value)
                            <option value="{{$value['id']}}" {{$value['id']==$dataInfo['brand_id']?"selected=selected":""}}>{{$value['name']}}</option>
                        @empty
                        @endforelse
                    </select>
                </div>
            </div>
            <div class="row">
                <div class="label"><span class="require">*</span>设备图片：</div>

                    <div class="control-text j_fileUpload">
                         @if ($dataInfo['img_list'])
                                <div class="file_list">
                                    <ul class="j_fileList">
                                        @forelse ($dataInfo['img_list'] as $key=>$value)
                                            <li>
                                                <img src="{{$value['url']}}" width="88" height="88" alt="">
                                                <a class="j_delImg">×</a>
                                                <input class="j_originalName" type="hidden" value="{{$value['name']}}">
                                                <input class="j_remoteName" type="hidden" value="{{$value['url']}}">
                                                <input class="j_md5" type="hidden" value="{{$value['md5']}}">
                                                <input class="j_thumbUrl" type="hidden" value="{{$value['thumbUrl']}}">
                                            </li>
                                        @empty
                                        @endforelse
                                    </ul>
                                </div>
                        @endif

                        <div class="file_select">
                            <div class="form-control-static">
                                <a class="btn btn-small btn-primary">浏览</a>
                                <input id="fileUpload" class="txt_file j_fileSelect" data-multi="true" name="files" type="file">
                            </div>
                        </div>
                    </div>
            </div>
            <div class="row">
                <div class="label"><span class="require">*</span>设备介绍：</div>
                <div class="control-text">
                    <script id="device_desc" name="content" type="text/plain">{!! $dataInfo['device_desc'] !!}</script>
                </div>
            </div>
            <div class="row">
                <div class="label">&nbsp;</div>
                <div class="control-text">
                    <input id="device_id" type="hidden" value="{{$device_id}}">
                    <a class="btn btn-warning j_deviceSave" data-chk="1">保存</a>
                    <a class="btn btn-primary j_deviceSave" data-chk="2">保存并提交审核</a>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection

@section('script')
<script src="{{env('STATIC_PATH')}}/libs/ajaxfileupload.js"></script>
<script src="{{env('STATIC_PATH')}}/js/user_device.js"></script>
@endsection
